package ar.com.globallogic.promomr.persistance;

import java.util.List;

import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import ar.com.globallogic.promomr.domain.Content;

@Repository
public interface ContentRepository extends CrudRepository<Content, String>{
	
	@Query("{$and: [" +
				"{$or:[{$where:'?0==null'},{name: ?0}]}, " +
				"{$or:[{$where:'?1==null'},{description: ?1}]}" +
			"]}")
	public List<Content> findByProperties(String name, String description);

}
